/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ua.i.kotionokyurievna.jewelryweb.controllers;

import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import ua.i.kotionokyurievna.jewelryweb.entities.Person;
import ua.i.kotionokyurievna.jewelryweb.entities.UserRole;

/**
 *
 * @author kotionokyurievna
 */
@ManagedBean
@RequestScoped
public class UsersListController {

    private List<Person> persons;
    /**
     * Creates a new instance of UsersListController
     */
    public UsersListController() {
        persons = new ArrayList<Person>();
    }

    public List<Person> getPersons() {
        return persons;
    }

    public void setPersons(List<Person> persons) {
        this.persons = persons;
    }
    
    public List<Integer> getIds(){
        ArrayList<Integer> ids = new ArrayList<Integer>();
        for ( Person p: persons){
            ids.add(p.getUserId());
        }
        return ids;
    }
    
    public List<String> getNames(){
        ArrayList<String> names = new ArrayList<String>();
        for ( Person p: persons){
            names.add(p.getFirstName());
        }
        return names;
    }
    
    public List<String> getSurnames(){
        ArrayList<String> surnames = new ArrayList<String>();
        for ( Person p: persons){
            surnames.add(p.getLastName());
        }
        return surnames;
    }
    
    public List<UserRole> getRoles(){
        ArrayList<UserRole> roles = new ArrayList<UserRole>();
        for ( Person p: persons){
            roles.add(p.getRole());
        }
        return roles;
    }
    
    public List<String> getEmails(){
        ArrayList<String> emails = new ArrayList<String>();
        for ( Person p: persons){
            emails.add(p.getEmail());
        }
        return emails;
    }
    
    public void deleteUser(){
        
    }
    
}
